package cc.messcat.web.system;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cc.messcat.common.constant.CommonConstant;
import cc.messcat.common.model.ResponseBean;
import cc.messcat.entity.level.UserLevel;
import cc.messcat.entity.system.McUser;
import cc.messcat.service.system.UserLevelService;

@Controller
@RequestMapping("/userLevel")
public class UserLevelController {

	
	@Autowired
	private UserLevelService userLevelService;

	@RequestMapping(value = "getUserLevelAll", method = RequestMethod.GET)
	@ResponseBody
	public Object getRoleLevelAll(HttpSession session) throws Exception {
		McUser user = (McUser) session.getAttribute("user");
		Long areaId = user.getAreaId();
		UserLevel userLevel = user.getUserLevel();
		List<UserLevel> userLevels = userLevelService.listUserLevels(userLevel);
		return new ResponseBean(CommonConstant.SUCCESS_CODE_200, CommonConstant.MSG_FIND_SUCCESS, userLevels);
	}
}
